using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace HamcoWcs.Entitys.NodeInfos
{
    public class NodeInfoConfig : IEntityTypeConfiguration<NodeInfo>
    {
        public void Configure(EntityTypeBuilder<NodeInfo> builder)
        {
            builder.HasComment("路径模块-节点信息");
            builder.Property(x => x.NodeName).IsRequired().HasComment("节点名（上位名称）");
            builder.Property(x => x.NextNode).IsRequired().HasMaxLength(255).HasComment("下一个节点 ‘；’分割");
            builder.Property(x => x.InName).IsRequired().HasComment("入库端设备名");
            builder.Property(x => x.OutName).IsRequired().HasComment("出库端设备名");
            builder.Property(x => x.DeviceType).IsRequired().HasComment("节点设备类型");
            builder.Property(x => x.AlternateNode).IsRequired().HasComment("备用节点");
            builder.Property(x => x.FPriority).HasDefaultValue(0).HasComment("起始地优先级增益");
            builder.Property(x => x.TPriority).HasDefaultValue(0).HasComment("目的地优先级增益");
            builder.Property(x => x.NodeMode).HasDefaultValue(0).HasComment("节点模式");

            builder.HasIndex(x => x.NodeName).IsUnique();

            //builder.Property(x => x.NodeName).IsRequired().HasMaxLength(30).HasComment("点位名");
            //builder.Property(x => x.DeviceType).HasMaxLength(30).HasComment("设备类型:Con、Srm、Agv");
            //builder.Property(x => x.PlcName).HasMaxLength(30).HasComment("Plc名");
            //builder.Property(x => x.WmsNodeName).HasMaxLength(30).HasComment("Wms点位名");
            //builder.Property(x => x.NextNode).HasMaxLength(255).HasComment("下一节点名：多节点用;分开");
            //builder.Property(x => x.ExcuteSrm).HasMaxLength(255).HasComment("堆垛机名");
            //builder.Property(x => x.Bay).HasComment("站台列");
        }
    }
}